package xin.yangshuai.basic01.str;

/**
 * Hello
 *
 * @author shuai
 * @date 2022/6/20
 */
public class Hello {
    public static void main(String[] args) {
        String s1 = "ab" + "cd";
        String s2 = new String("a") + new String("b");
        String s3 = s2.intern();
        System.out.println(s2 == s3);

        String s4 = "ef";
        String s5 = new String("e") + new String("f");
        String s6 = s5.intern();
        System.out.println(s5 == s6);

        String s7 = "aaaa|bbbb|ccc|";
        String[] split1 = s7.split("\\|");
        System.out.println(split1);
        System.out.println("------------------------------------");
        String s8 = "helloworld";
        System.out.println(s8);
        System.out.println(s8.length());
        String s9 = "hello\nworld";
        System.out.println(s9);
        System.out.println(s9.length());
        System.out.println(s9.charAt(5));
        System.out.println(s9.charAt(6));
        String s10 = "hello\\nworld";
        System.out.println(s10);
        System.out.println(s10.length());
        System.out.println(s10.charAt(5));
        System.out.println(s10.charAt(6));
        System.out.println("------------------------------------");
    }

//    public static void main(String[] args) {
//        String s1 = new StringBuilder("ja").append("va").toString();
//        String intern1 = s1.intern();
//        System.out.println(s1 == intern1);
//        String s2 = new StringBuilder("bei").append("jing").toString();
//        String intern2 = s2.intern();
//        System.out.println(s2 == intern2);
//        String s3 = new StringBuilder("1.8.0").append("_231").toString();
//        String intern3 = s3.intern();
//        System.out.println(s3 == intern3);
//        System.out.println("----------------------------------------");
//        String s4 = new String("hello") + new String("hello");
//        String s5 = "hellohello";
//        String intern4 = s4.intern();
//        System.out.println(s4 == s5);
//        System.out.println(s4 == intern4);
//        System.out.println(s5 == intern4);
//        String s6 = new String("hi") + new String("hi");
//        String intern6 = s6.intern();
//        String s7 = "hihi";
//        System.out.println(s6 == intern6);
//        System.out.println(s6 == s7);
//        System.out.println(intern6 == s7);
//        System.out.println("----------------------------------------");
//        String s8 = "ni" + "hao" + "ni";
//        String s9 = new String("ni") + new String("haoni");
//        String intern9 = s9.intern();
//        System.out.println(s9 == intern9);
//    }


}
